#include "buttonskin.h"
#include <allegro5/allegro_image.h>
#include <iostream>
#include <cstdlib>
using namespace std;

ButtonSkin::ButtonSkin(const std::string &imagefile, int width, int height,
		       const ALLEGRO_COLOR &downColor)
: m_width(width), m_height(height), m_pBitmap(NULL),
  m_downColor(downColor){
     m_pBitmap = al_load_png(imagefile.c_str());
     if (!m_pBitmap) {
	  cout << "error loading button image from file '" \
	       << imagefile << "'" << endl;
	  exit(1);
     }
}

ButtonSkin::~ButtonSkin() {
     al_destroy_bitmap(m_pBitmap);
}

int ButtonSkin::width() {
     return m_width;
}

int ButtonSkin::height() {
     return m_height;
}

ALLEGRO_BITMAP* ButtonSkin::bitmap() {
     return m_pBitmap;
}

const ALLEGRO_COLOR& ButtonSkin::downColor() {
     return m_downColor;
}
